<?php
session_start(); 
if(!isset($_SESSION['userName'])){
header( 'location: index.php' ); 
}

include("conf/connect.php");
	$user_id = $_SESSION['user_id'];
	
	$sql="select * from track WHERE user_id='$user_id'";
	$result =mysql_query($sql) or die ("problem budget_heads");
	$data = mysql_fetch_array($result);
	$totalNumberOfRow = mysql_num_rows($result);
	
	if ($totalNumberOfRow == 1 ){
		$cp = $data['qid'];
		$_SESSION['lid']= $data['appid'];
		$_SESSION['usrHHid'] = $data['hid'];
		if(is_numeric($cp)){
			if($cp == 8 )
		    	header( "location: qus7.php");
			else if($cp == 9 )
		    	header( "location: qus8.php");
			else
				header( "location: qus1.php?serial=$cp");
		}
		else{
			if($cp =='rel_detail')
				header( "location: rel_detail.php");
			else
				header( "location: qus4.php?serial=$cp");
		}
	}
	else{
		header( 'location:index2.php?con=no' );
	}
  
?>